package com.user.chris.entity.vo;

import com.common.chris.entity.BaseVO;
import com.common.chris.exception.BusinessException;
import lombok.Data;
import org.springframework.util.StringUtils;

import java.util.Objects;

/**
 * @author wujf
 * @date 2021/10/27
 */
@Data
public class TestVO extends BaseVO {

    private String name;
    private Integer age;

    @Override
    public void validate() throws BusinessException {
        if (StringUtils.isEmpty(name)) {
            throw new BusinessException("5001", "name为空");
        }
        if (Objects.isNull(age) || age > 100) {
            throw new BusinessException("5002", "年龄为空或者过大");
        }
    }
}
